Main Page | Class List | Class Members

BustaNetServer Class Reference

Server network module for Busta'Sandwich. More...

#include <BustaNetServer.h>

List of all members.

Public Member Functions

 BustaNetServer ()
 Constructor.
 ~BustaNetServer ()
 Destructor.
char * init (Uint16 servport)
 Initialize the server.
void sendAccept (int playerID, bool response, char *message)
 Sends a connection response to a connecting client.
void sendCharacterSelectModeAll ()
 Notifies all connected clients that multiplayer character selection is taking place.
void sendDisconnectedAllO (int disc_client, char *message)
 Send a disconnect notification to all connected clients.
void sendPlayerLostAllO (int lost_player)
 Sends a notification to all client when one client has lost in the current game.
void sendServerSetupAll ()
 Sends server information to all connected clients.
void sendGameStartAll ()
 Notifies all connected clients to start the multiplayer game.
void sendUpdateAll ()
 Sends client game state information to all connected clients.
void setDebug (bool OnOff)
 Sets the server in debug mode.
void setMaxClients (int maxC)
 Sets the maximum number of allowed connections.
void setName (char *servname)
 Sets the name of the server.
int setStateAccept ()
 Sets the server in client connection accepting mode.
int setStateCharSelect ()
 Sets the server in client character selection mode.
int setStateGame ()
 Sets the server in game mode.


Detailed Description

Server network module for Busta'Sandwich.

Standalone server class for hosting and handling multiplayer games of Busta'Sandwich..


Constructor & Destructor Documentation

BustaNetServer::BustaNetServer  ) 
 

Constructor.

BustaNetServer::~BustaNetServer  ) 
 

Destructor.


Member Function Documentation

char * BustaNetServer::init Uint16  servport  ) 
 

Initialize the server.

Initializes SDL and SDLNet. A socket to connect to the server is created for the server's ip address on the specified port.

Parameters:
servport The port number to host the game on
Returns:
Returns a error message if an error occurs during initialization. On no error null is returned.

void BustaNetServer.sendAccept int  playerID,
bool  response,
char *  message
 

Sends a connection response to a connecting client.

Responds to a client's connection attempt. The client is sent a message detailing whether or not the connection was allowed, a message describing why or why not the connection was allowed, and the player's identification number if the connection was accepted.

Parameters:
playerID Player's identification number on accepted connection
response Response to the connection attempt. True for allow, false for deny
message Description of the server's response; why allowed or denied

void BustaNetServer.sendCharacterSelectModeAll  ) 
 

Notifies all connected clients that multiplayer character selection is taking place.

A message is sent to all clients connected to the server that all clients are to now select a multiplayer character.

void BustaNetServer.sendDisconnectedAllO int  disc_client,
char *  message
 

Send a disconnect notification to all connected clients.

Sends a notification message to all clients that are still connected when a client disconnects from the server. Includes details as to why client disconnected.

Parameters:
disc_client Identification number of the disconnected client
message Reason for client disconnection

void BustaNetServer.sendGameStartAll  ) 
 

Notifies all connected clients to start the multiplayer game.

A message is sent to all connected clients that the multiplayer game is now starting.

void BustaNetServer.sendPlayerLostAllO int  lost_player  ) 
 

Sends a notification to all client when one client has lost in the current game.

A notification that a client has lost in the current multiplayer game is sent to all other connected clients. The player who has lost is not notified.

Parameters:
lost_player Identification number of the player who has lost

void BustaNetServer.sendServerSetupAll  ) 
 

Sends server information to all connected clients.

A message containing the server settings and information is sent to all clients.

void BustaNetServer.sendUpdateAll  ) 
 

Sends client game state information to all connected clients.

Sends game state information to all connected clients. This includes the brief information required by each player as well as the detailed game state requested by each client.

void BustaNetServer::setDebug bool  OnOff  ) 
 

Sets the server in debug mode.

Turns on debugging output to the console for the server.

Parameters:
OnOff Boolean to turn on or off debugging output

void BustaNetServer::setMaxClients int  maxC  ) 
 

Sets the maximum number of allowed connections.

Specifies the maximum number of simultaneous connections allowed by clients at any given time.

Parameters:
maxC The maximum number of clients to allow

void BustaNetServer::setName char *  servname  ) 
 

Sets the name of the server.

Assigns the server an identification name.

Parameters:
servname The name to give the server

int BustaNetServer::setStateAccept  ) 
 

Sets the server in client connection accepting mode.

The server is now in a state to accept incoming TCP connections from clients. The server may leave this mode when all connected clients have sent a ready notification to the server and there is at least two connected clients.

Returns:
Returns an integer greater than or equal to zero if the above condition is met. A negative integer is returned on error in this mode.

int BustaNetServer::setStateCharSelect  ) 
 

Sets the server in client character selection mode.

The server is now in a state that allows clients to select a multiplayer character. The server leaves this mode when all connected clients have sent a selected character to the server. The server may also leave this mode if client disconnects occur leaving less than two connected clients.

Returns:
Returns an integer greater than zero if all connected clients have selected a character. Returns zero if client disconnects leaves less than two players. Returns a negative value on error.

int BustaNetServer.setStateGame  ) 
 

Sets the server in game mode.

The server is now in multiplayer game mode. All clients are currently playing the game. The server leaves this mode when all but one player has lost in the game or less than two clients remain connected to the server while in this mode.

Returns:
Returns an integer greater than zero if a winner is determined. Returns 0 if less than two clients are connected and a negative value on error.


Generated on Tue Jul 19 21:00:58 2005 for BustaSandwich Server by  doxygen 1.4.2-20050421